# coding=utf-8

from web import form

import utils

class EmailValidator(form.Validator):
    """Email验证器"""
    def __init__(self, msg = '邮箱格式错误。'):
        self.msg = msg

    def valid(self, value):
        return utils.is_email(value)

class Range(form.Input):
    """
    type=range的文本框
    """
    def get_type(self):
        return 'range'

class Date(form.Input):
    """
    type=date的文本框
    """
    def get_type(self):
        return 'date'

class Number(form.Input):
    """
    type=number的文本框
    """
    def get_type(self):
        return 'number'

class Email(form.Input):
    """
    type=Email的文本框
    """
    def get_type(self):
        return 'email'

class Url(form.Input):
    def get_type(self):
        return 'url'
